package com.ydl.shopping.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydl.shopping.core.entity.BaseEntity;
import com.ydl.shopping.core.valid.ValidGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;

/** 商品表 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("tb_goods")
@Schema(name = "商品表")
public class TbGoods extends BaseEntity {
    /** 名称 */
    @TableField("name")
    @NotBlank(groups = ValidGroup.Crud.Create.class, message = "名称不能为空")
    @NotBlank(groups = ValidGroup.Crud.Update.class, message = "名称不能为空")
    @Schema(description = "名称")
    private String name;

    /** 图片 */
    @TableField("cover")
    @Schema(description = "图片")
    private String cover;

    /** 单价 */
    @TableField("unit_price")
    @Schema(description = "单价")
    private BigDecimal unitPrice;

    /** 库存数量 */
    @TableField("quantity")
    @Schema(description = "库存数量")
    private Integer quantity;

    /** 是否上架 */
    @TableField("is_up")
    @Schema(description = "是否上架")
    private Integer isUp;

    /** 是否推荐 */
    @TableField("is_recommend")
    @Schema(description = "是否推荐")
    private Integer isRecommend;

    /** 状态 */
    @TableField("status")
    @Schema(description = "状态")
    private Integer status;
}
